package com.example.tianyutong.qanda.ui.page_4.adapter;

import android.content.Intent;
import android.text.TextUtils;
import android.view.View;

import com.example.tianyutong.qanda.R;
import com.example.tianyutong.qanda.base.binding.BaseBindingAdapter;
import com.example.tianyutong.qanda.base.binding.BaseBindingHolder;
import com.example.tianyutong.qanda.bean.GankIoDataBean;
import com.example.tianyutong.qanda.databinding.ItemAndroidBinding;
import com.example.tianyutong.qanda.databinding.ItemMyQuestionBinding;
import com.example.tianyutong.qanda.ui.bean.QuestionUser;
import com.example.tianyutong.qanda.ui.question.QuestionDetailActivity;
import com.example.tianyutong.qanda.utils.GlideUtil;

/**
 * 这个类在fragment实例的initRecyclerView（）里使用
 */

public class MyQuestionAdapter extends BaseBindingAdapter<QuestionUser, ItemMyQuestionBinding> {


    public MyQuestionAdapter() {
        super(R.layout.item_my_question);
    }


    @Override
    protected void bindView(BaseBindingHolder holder, QuestionUser object, ItemMyQuestionBinding binding, int position) {
        binding.questionTitle.setText(object.title);
        binding.questionPic.setVisibility(View.GONE);
        binding.llAll.setOnClickListener(v ->
                {
                    long id = object.questionId;
                    Intent intent = new Intent(v.getContext(), QuestionDetailActivity.class);
                    intent.putExtra("_id", id);
                    v.getContext().startActivity(intent);
                }

        );

        binding.setResultsBean(object);
        binding.setCommand(MyQuestionAdapter.this);
        binding.executePendingBindings();
    }

}
